package com.summer.shopping.controller;

import com.summer.shopping.domain.common.req.ReqHolder;
import com.summer.shopping.service.fun.CampaignService;
import com.summer.shopping.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@CrossOrigin
@RequestMapping("campaign")
public class CampaignController {


    @Autowired
    CampaignService campaignService;


    @PostMapping("checkin")
    public Result<String> checkin(){
        Long userId = ReqHolder.getUserId();
        return Result.ok(campaignService.checkInCampaign(userId));
    }

    @GetMapping("is/checkin")
    public Result<Boolean> isCheckin(){
        Long userId = ReqHolder.getUserId();
        return Result.ok(campaignService.isCheckIn(userId));
    }

}
